package cb.com.etcdemo;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

/**
 * Created by 他的猫 on 2017/4/6.
 */

public class BaseActivity extends FragmentActivity {
    private BaseApplication application;
    private BaseActivity oContext;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        if (application == null) {
            // 得到Application对象
            application = (BaseApplication) getApplication();
        }
        oContext = this;// 把当前的上下文对象赋值给BaseActivity
        addActivity();// 调用添加方法
    }

    // 添加Activity方法
    public void addActivity() {
        application.addActivity(oContext);// 调用myApplication的添加Activity方法
    }
}
